* Clean up
clear all

/* Set working directory: please set your own
cd "~/Dropbox/JOP third submission/JOP replication/"
*/

* Open dataset

use 01_data/cis_data.dta, clear

* Generate interaction
gen prefdem_pp = democracy_pref * pp_dummy

* Run analyses
regr cabine_use democracy_pref, cluster(municipality)
est store prefsystem_1
estadd local Controls "No"

regr cabine_use democracy_pref female i.income age age_sq i.education  i.TAMUNI i.CCAA, cluster(municipality)
est store prefsystem_2
estadd local Controls "Yes"

regr cabine_use democracy_pref pp_dummy prefdem_pp, cluster(municipality)
est store prefsystem_3
estadd local Controls "No"

regr cabine_use democracy_pref pp_dummy prefdem_pp female i.income age age_sq i.education i.TAMUNI i.CCAA, cluster(municipality)
est store prefsystem_4
estadd local Controls "Yes"

* Make table
esttab prefsystem_1 prefsystem_2 prefsystem_3 prefsystem_4 using 03_tables/tablef3.tex, tex se replace  keep (democracy_pref pp_dummy prefdem_pp) coeflabels (democracy_pref "Prefers democracy" pp_dummy "PP voter" prefdem_pp "Prefer dem x PP voter") star(* 0.10 ** 0.05 *** 0.01) s(Controls, label("Controls")) nomtitles addnotes("Standard errors are clustered by municipality" "The outcome variable is a dummy for whether each respondent used a private" "voting booth to cast their vote in the general election of November 2019" "Models 2 and 4 include controls for income, education, age, age squared, size of" "respondent's municipality, and a dummy for respondents identifying as female")
